<template>
  <div>
    <div>
      <van-nav-bar
          title="账单详情"
          left-arrow
          @click-left="onClickLeft"
      />
    </div>
    <div style="width: 100%;height: 80px;background-color: white">
      <span id="span">{{bill.classify=='提现'?'-':'+'}}{{bill.money}}₱</span>
    </div>
    <div>
      <van-cell title="账单分类" style="text-align: left" :value="bill.classify" size="large" />
      <van-cell title="交易时间" style="text-align: left" :value="bill.overTime|formatTimer" size="large" />
      <van-cell :title="bill.classify=='提现'?'提现方式':'支付方式'" style="text-align: left" :value="bill.classify=='提现'?bill.payWay==1?'银行卡':'支票':bill.payWay==1?'微信支付':'支付宝支付'" size="large" />
      <van-cell title="交易单号" style="text-align: left" :value="bill.orderNo" size="large" />
    </div>
  </div>
</template>

<script>
import axios from "axios";

export default {
  data() {
    return {
      bill:{}
    }
  },
  mounted() {
    this.bill=this.$route.query.data;
  },
  filters: {
    formatTimer: function(value) {
      let date = new Date(value);
      let y = date.getFullYear();
      let MM = date.getMonth() + 1;
      MM = MM < 10 ? "0" + MM : MM;
      let d = date.getDate();
      d = d < 10 ? "0" + d : d;
      let h = date.getHours();
      h = h < 10 ? "0" + h : h;
      let m = date.getMinutes();
      m = m < 10 ? "0" + m : m;
      let s = date.getSeconds();
      s = s < 10 ? "0" + s : s;
      return y + "-" + MM + "-" + d + " " + h + ":" + m;
    }
  },
  methods: {
    onClickLeft() {
      this.$router.push({
        path: '/bill'
      })
    },
    getbillbyId(id){
      axios.get('http://localhost:11219/mine/bill/getbillbyid/'+id).then(res=>{
        this.bill=res.data;
      })
    }
  }
}
</script>

<style scoped>
#span{
  position: absolute;left: 50%;
  transform: translateX(-50%);
  margin-top: 10px;
  font-size: 35px;
}
</style>
